<template>
  <j-modal
    title="项目列表"
    :visible="visible"
    width="800px"
    ok-text=""
    :footer="null"
    :ok-button-props="{ props: { disabled: true } }"
    @close="close"
  >
    <a-card :bordered="false">
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :scroll="{ x: 650,y:500 }"
        :dataSource="dataSource"
        :pagination="false"
        :loading="loading"
      >
      </a-table>
      <!-- table区域-end -->
    </a-card>
  </j-modal>
</template>
<script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { httpAction, getAction, postAction, deleteAction } from '@/api/manage'
import columns from './tempCheckColumns'

export default {
  name: 'tempCheck',
  mixins: [JeecgListMixin],
  components: {},
  data() {
    return {
      // 表头
      columns: columns(this),
      queryParam: {},
      url: {
        list: '/performcheck/checkProjectInfo/queryTemplateProject',
      },
      visible: false,
      dataSource: [],
    }
  },
  computed: {},
  methods: {
    check(record) {
      this.dataSource = []
      this.queryParam.id = Object.assign({}, record).id
      this.loadData()
      this.visible = true
    },
    close() {
      this.visible = false
    },
    mergeCells(text, data, key, index) {
      // 上一行该列数据是否一样
      if (index !== 0 && text === data[index - 1][key]) {
        return 0
      }
      let rowSpan = 1
      // 判断下一行是否相等
      for (let i = index + 1; i < data.length; i++) {
        if (text !== data[i][key]) {
          break
        }
        rowSpan++
      }
      return rowSpan
    },
    setBr(text, data, key, index) {
      if (data[key] != null) {
        let contents = data[key].split('/')
        let item = null
        for (let i = 0; i < contents.length; i++) {
          if (i == 0) {
            item = `(${i + 1}) ${contents[i]}`
          } else {
            item = (
              <span>
                {item}
                <br />
                {`(${i + 1}) ${contents[i]}`}
              </span>
            )
          }
        }
        return item
      }
    },
  },
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>